# Summing multiple of 3 and 5 is equivalent to
# Summing multiple of 3 + multiple of 5 - multiple of 15
#
# Arithmetic suite:
# S = a + 2*a + 3*a + 4*a + ... + n*a
# S = a * n * (1 + n) / 2

def S(a, n):
    return a * n * (1 + n) / 2

def Solve():
    return sum(S(a, 999 // a) for a in [3, 5, -15])



